﻿/******************************************************   
创建者: ljj
创建时间: 2018-01-16
修改:
修改时间: 
功能: 单品有效计算导出
 ******************************************************/

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.nm.library.Excels;
using System.ComponentModel.Composition;

namespace InventoryToPredictAPI.Export
{
    [Export(typeof(ExcelImport))]
    public class GoodsSingleValidCalc : ExcelImport
    {
        public override ExcelImportType Type => ExcelImportType.GOODSSINGLEVALIDCALC;
        public override Dictionary<string, ImportVerify> DictFields => _dictFields;

        private static readonly Dictionary<string, ImportVerify> _dictFields = new List<ImportVerify> {
            new ImportVerify{ ColumnName="区域",FieldName="ParentAreaID",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="大类",FieldName="KindName",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="子项",FieldName="ItemOrSub",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="货号",FieldName="MaterialID",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="性别",FieldName="SexName",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="零售价",FieldName="RetailPrice",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="订单属性",FieldName="OrderAttribID",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="近一周畅滞销状态",FieldName="AllCzpFlagNow",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="累计畅滞销状态",FieldName="AllCzpFlag",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="标准陈列量",FieldName="DisplayQty",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="周数",FieldName="WeekNo",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="店数",FieldName="ShopCount",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="期初库存",FieldName="InitQty",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="预计回货",FieldName="ReturnQty",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="预计销售",FieldName="PlanSaleQty",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="结存数量",FieldName="BalanceQty",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="有效数量",FieldName="AfterReturnValidQty",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="有效金额",FieldName="AfterReturnValidTagAmount",DataType=typeof(decimal?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="有效性",FieldName="AfterReturnValidType",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
        }.ToDictionary(e => e.ColumnName, e => e);

        public override DataTable GetExportData(string Keys)
        {
            var handler = new GoodsSingleValidCalcHandler();
            return handler.ExportGoodsSingleValidCalc(Keys);
        }

        public override object SaveImportData(DataTable dt, Dictionary<string, object> extraInfo, int userId)
        {
            throw new NotImplementedException();
        }
    }
}
